import Vue from 'vue';
import { Router } from '@/common/utils/index.js';
import { needLoginPages,IMGSOURCE, STATIC_URL } from '@/common/config.js';
const router = new Router({ needLoginPages });

Vue.mixin({
	data(){
		return {
			IMGSOURCE,
			STATIC_URL: STATIC_URL
		}
	},
  methods: {
    // 页面跳转
    handleJump(e) {
		console.log(e,88888)
      let target = e.currentTarget || e.target,
        url = target.dataset.url || 'back',
        type = target.dataset.type;
      if (url == '' || url == '#') return;
      switch (type) {
        case 'SWITCH':
          router.switchTab(url);
          break;
        case 'REDIRECT':
          router.redirectTo(url);
          break;
        case 'RELAUNCH':
          router.reLaunch(url);
          break;
        case 'BACK':
          router.navigateBack();
          break;
        default:
          router.navigateTo(url);
          break;
      }
    }
  }
})
